import numpy as np

arr = np.arange(12).reshape(3, 4)
print(arr)
print("------------------")
# 使用T属性对arr转置
print(arr.T)
print("------------------")
# 转置，0为x，1为y, 设置为1,0，代表xy互换
print(arr.transpose(1, 0))
print("------------------")
arr1 = np.arange(12).reshape(2, 2, 3)
print(arr1)
print("------------------")
# 将xy互换
print(arr1.transpose(1, 0, 2))
print("------------------")
# swapaxes是将n维数组中两个维度进行调换,xy互换
print(arr1.swapaxes(1, 0))
